package cn.shop.ylp;

import cn.shop.ylp.*;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;

@SpringBootApplication(scanBasePackages = {"cn.shop.ylp"})
@RestController
@MapperScan({"cn.shop.ylp"})
public class App {
    @Autowired
    private UserMapper userMapper;

    // 读取所有用户
    @RequestMapping("/client")
    public String client(){
        User user = userMapper.selectByPrimaryKey(1);
        if (user == null){
            return "用户对象不存在";
        } else {
            return user.getPhone();
        }
    }
    public static void main(String[] args) throws UnsupportedEncodingException, NoSuchAlgorithmException {

        SpringApplication.run(App.class,args);

    }


}
